package com.yao.mall.service;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yao.mall.common.PageRequest;
import com.yao.mall.model.dto.UserRequest;
import com.yao.mall.model.dto.UserSearchRequest;
import com.yao.mall.model.entity.User;
import com.yao.mall.model.vo.UserVO;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;

/**
* @author jiahua.yao
* @description 针对表【user】的数据库操作Service
* @date 2024-02-29 13:06:36
*/
public interface UserService extends IService<User> {
    /**
     * 统一的登录接口
     * @param userRequest userDTO
     * @return Stirng
     */
    UserVO userLogin(UserRequest userRequest);

    /**
     * 密码登录,账号可以为账号、电话、邮箱
     * @param userRequest userDTO
     * @return user
     */
    User loginByPassword(UserRequest userRequest);

    /**
     * 邮箱登录
     * @param userRequest userDTO
     * @return user
     */
    User loginByEmail(UserRequest userRequest);

    /**
     * 手机号码登录
     * @param userRequest userDTO
     * @return user
     */
    User loginByPhone(UserRequest userRequest);

    /**
     * 发送验证码 用于登录
     * @param userRequest userDTO
     * @return boolean
     */
    boolean sendLoginCode(UserRequest userRequest);

    /**
     * 发送email的验证码，用于注册、登录
     * @param userRequest userDTO
     * @return userDTO
     */
    boolean sendRegEmail(UserRequest userRequest);

    /**
     * 发送手机验证码
     * @param userRequest userDTO
     * @return boolean
     */
    boolean sendPhoneCode(UserRequest userRequest);

    /**
     * 账户注册
     * @param userRequest userDTO
     * @return Boolean
     */
    String userRegister(UserRequest userRequest);

    /**
     * 用户注销
     * @param request
     * @return Boolean
     */
    Boolean userLogout(HttpServletRequest request);

    /**
     * 修改基本信息（昵称、性别
     * @param userRequest
     * @return UserVO
     */
    UserVO userUpdateBasic(UserRequest userRequest);

    /**
     * 更新头像
     * @param file 头像
     * @return String 图片地址
     */
    String userUpdatePic(MultipartFile file);

    /**
     * 获取用户信息数据
     * @param userSearchRequest 查询条件
     * @return
     */
    Page<UserVO> getUserList(UserSearchRequest userSearchRequest);

    /**
     * 禁用用户
     * @param id 用户id
     * @return boolean
     */
    Boolean toBanUser(Long id);

}
